<script setup>
import { ref, onMounted } from 'vue'
import { getGoodsdata } from '/src/api/layout.js' // 注意：我移除了 getGoodsid，因为它在模板中未使用
import { useUserStore } from '/src/stores/modules/user'
import './styles/base.css' // css 样式重置
import './styles/common.css' // 公共全局样式
import '/src/assets/iconfont/iconfont.css' // 字体图标的样式
import GoodsBanner from './components/GoodsBanner.vue'
import GoodsFooter from './components/GoodsFooter.vue'
import GoodsHeadNav from './components/GoodsHeadNav.vue'
import GoodsHotBrand from './components/GoodsHotBrand.vue'
// import GoodsNewGoods from './components/GoodsNewGoods.vue'
import GoodsTopic from './components/GoodsTopic.vue'
import { searchCategory } from '/src/api/layout.js'
const options = ref([])
const getcategory = async () => {
  const res = await searchCategory()
  options.value = res.data
}
getcategory()
const userStore = useUserStore()
onMounted(() => {
  userStore.getUser()
})
const needdata = ref([{ id: '1', name: 'nihao' }]) // 初始化 data 为一个具有 data 属性的空对象
const getdata = async () => {
  const response = await getGoodsdata()
  needdata.value = response.data // 假设 response.data 是你需要的数组
  console.log(needdata.value)
}
getdata()
</script>
<template>
  <div class="App">
    <!-- 快捷链接  -->
    <!-- 头部导航  -->
    <goods-head-nav :data="options"></goods-head-nav>
    <!-- 轮播区域 -->
    <goods-banner :data="options" :ndata="needdata"></goods-banner>
    <!-- 新鲜好物 -->
    <!-- 热门品牌 -->
    <goods-hot-brand></goods-hot-brand>
    <!-- 最新专题 -->
    <goods-topic :data="needdata"></goods-topic>
    <!-- 版权底部 -->
    <goods-footer></goods-footer>
  </div>
</template>
<style lang="scss" scoped></style>
